#include "aimage.h"

void AIMAGE::colrange( float low, float hi )
{
	float scale;
	APIXEL *begin, *cur, *end;

	begin = m_image[0];
	end = begin + ( m_width * m_height );
	unsigned int clip_low = FULL_INT * low ;  

	for ( cur = begin; cur != end; ++cur )
	{
		if ( cur->r < clip_low )
		{
			cur->r = 0;
		}
		else
		{
			cur->r -= clip_low;
		}
		if ( cur->g < clip_low )
		{
			cur->g = 0;
		}
		else
		{
			cur->g -= clip_low;
		}
		if ( cur->b < clip_low )
		{
			cur->b = 0;
		}
		else
		{
			cur->b -= clip_low;
		}
	}
}

